package com.itheima.day11.charstream.test5$;

import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;

public class Demo {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入用户名：");
        String username = sc.nextLine();
        System.out.println("请输入用户密码：");
        String userpassword = sc.nextLine();

        FileWriter fw = null;
        try {
            fw = new FileWriter("myCode\\src\\\\com\\itheima\\day11\\c.txt");
            fw.write("用户名：" + username);
            fw.write("\r\n");
            fw.write("密码：" + userpassword);
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if(fw != null){
                try {
                    System.out.println("创建成功");
                    fw.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
